channelRead & channelReadComplete |
您所在的位置:网站首页 › netty channelread0和channelread › channelRead & channelReadComplete |
问题来源
使用netty 接受消息时,channelReadComplete 执行了,但是channelRead 却没有执行. 问题详情参见: Netty channelRead never called 寻找解决方案 1.官网文档两个意思差不多都是执行完传给下一个handler. 执行没有先后顺序. 最后在知乎里看到这样一段话: 当添加了消息处理的handler,如lineBasedFrameDecoder或者FixLengthFramDecoder等,这样的话当消息没有到结束标志时,会进到complete方法里,到达消息的结束标志,才会调用read方法。 2.验证在消息末尾添加”\n” 结束符,解决. 原因使用lineBasedFrameDecoder 需添加结束符. 有不妥当之处,麻烦指出 |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |